import React, { Component } from 'react';
import './index.css'
import loading from './canvas'
export default class Canvas extends Component{
    constructor(data){
        super(data)
        this.flag=true
    }
    componentDidMount(){
        new loading({
            id:'canvas'
        })
    }
    componentDidUpdate(){
        if(this.props.str&&this.flag){
            this.flag=false
            new loading({
                id:'canvas',
                flag:true
            })
        }
    }
    render(){
        return(
            <div>
                <p>这是一个canvas</p>
                <canvas id="canvas" width="600" height="600">

                </canvas>
            </div>
        )
    }
} 